

export function contentExtract(content) {
    const re = /^\[([^\]]+)\]\s*(.*)$/;
    const matches = content.match(re);

    if (!matches || matches.length < 3) {
        return ["", ""];
    }
    // 明确指定捕获组的索引类型
    return [matches[1], matches[2]];
}

// 格式化文件大小
export function formatFileSize (bytes) {
    if (bytes < 1024) return `${bytes} B`
    if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`
    return `${(bytes / (1024 * 1024)).toFixed(1)} MB`
}